<html xmlns:th="http://www.thymeleaf.org">
<head th:include="basepage/head::head"></head>
<body>
<div id="page-wrapper" class="page-loading">
    <div class="preloader">
        <div class="inner">
            <!-- Animation spinner for all modern browsers -->
            <div class="preloader-spinner themed-background hidden-lt-ie10"></div>

            <!-- Text for IE9 -->
            <h3 class="text-primary visible-lt-ie10"><strong>Loading..</strong></h3>
        </div>
    </div>
    <div id="page-container" class="header-fixed-top sidebar-visible-lg-full">
        <header th:include="basepage/left::left"></header>
        <!--主要内容 START-->
        <div id="main-container" class="main-content">
<header th:include="basepage/header::header"></header>

	            <div id="page-content">
	                <div class="block full">
	                    <div class="block-title">
	                        <h2>服务列表</h2>
	                    </div>
	                    <div class="table-responsive">
	                        <table id="example-datatable" class="table table-striped table-bordered table-vcenter">
	                            <thead>
	                            <tr>
	                                <th width="10%">服务名称</th>
	                                <th width="10%">功能</th>
	                                <th width="10%">服务IP</th>
	                                <th width="10%">服务端口</th>
	                                <th width="15%">报警规则</th>
	                                <th width="15%">通知对象</th>
	                                <th width="15%">状态</th>
	                                <th class="text-center" style="width: 100px;"><i class="fa fa-flash"></i></th>
	                            </tr>
	                            </thead>
	                            <tbody>
                            	<p th:each="service:${list}">
	                            	<tr>
		                                <td th:text="${service.name}" class="text-center">服务名称</td>
		                                <td th:text="${service.forwhat}" class="text-center"></td>
		                                <td th:text="${service.serviceIp}"></td>
		                                <td th:text="${service.port}"></td>
		                                <td th:text="重启次数：+${service.needTimes+' '}+ 报警次数：+${service.needAlertTimes}">报警规则</td>
		                                <td th:text="${service.alertName}">通知对象</td>
		                                <td th:text="${service.status}">状态</td>
		                                <td class="text-center">
		                                    <a th:href="@{addServiceInfo(id=${service.id})}"  data-toggle="tooltip" title="编辑/添加"
		                                       class="btn btn-effect-ripple btn-xs btn-success" th:if="${service.id != null}"><i class="fa fa-pencil"></i></a>
		                                    <a th:href="@{addServiceInfo(name=${service.name},serviceIp=${service.serviceIp},port=${service.port})}"  data-toggle="tooltip" title="编辑/添加"
		                                       class="btn btn-effect-ripple btn-xs btn-success" th:if="${service.id == null}"><i class="fa fa-pencil"></i></a>
		                                    <a href="#frmMsg" data-toggle="modal" title="取消"
		                                       class="btn btn-effect-ripple btn-xs btn-danger" th:if="${service.id != null}" th:onclick="'del(\''+${service.id}+'\')'" ><i class="fa fa-times"></i></a>
		                                </td>
	                            	</tr>
                                </p>
	                            </tbody>
	                        </table>
	                    </div>
	                </div>
	                <!-- END Datatables Block -->
	            </div>
	            <!-- END Page Content -->
	  
	
	<div class="modal fade" id="frmMsg" tabindex="-1" role="dialog" aria-labelledby="frmMsgLabel" aria-hidden="true">
	    <div class="modal-dialog">
	        <div class="modal-content">
	            <form class="form-horizontal" id="delServiceForm" onsubmit="return false;">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	                    <h4 class="modal-title" id="frmMsgLabel">提示</h4>
	                </div>
	                <div class="modal-body">
	                    <div class="form-group">
	                        <div class="col-sm-3">
	                            <a href="#">
	                                <span class="glyphicon glyphicon-trash"></span>
	                            </a>
	                        </div>
	                        <div class="col-sm-9">
	                            <p class="form-control-static">您确定要删除吗？</p>
	                            <input id="id" name="id" type="hidden"/>
	                        </div>
	                    </div>
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-primary" onclick="form_submit_onclick('delServiceForm','delServiceInfo')">删除</button>
	                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	                </div>
	            </form>
	        </div>
	    </div>
	</div>
	
    <!-- END Page Content -->
        </div>
        <!--主要内容 END-->
        <!-- END Main Container -->
    </div>
    <!-- END Page Container -->
</div>
<!-- END Page Wrapper -->
<header th:include="basepage/footer::footer"></header>
<script type="text/javascript">
     $("#service_left").addClass("open");
     $("#service_list").addClass("active");
     function del(id){
    	 $("#id").val(id);
     }
</script>
</body>
</html>